var _ = require("lodash");
// _.sample(collection)
// 从collection（集合）中获得一个随机元素
let arr = [1, 2, 3, 4];
let a = _.sample(arr);
console.log(a);

// _.sampleSize(collection, [n=1])
// 从collection（集合）中获得 n 个随机元素
let b = _.sampleSize(arr, 2);
console.log(b);
